Skip to content

add https profile to caddy service in docker compose#141

Merged
AnkushMalaker merged 1 commit into
mainfrom
fix/caddyfile-error
Oct 24, 2025
Merged

add https profile to caddy service in docker compose#141
AnkushMalaker merged 1 commit into
mainfrom
fix/caddyfile-error

Conversation

@AnkushMalaker

@AnkushMalaker AnkushMalaker commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added selective service activation through profiles, enabling conditional startup of HTTPS and development environments
    • Automatic HTTPS enablement when running backend services with appropriate configuration
  • Chores

    • Updated service configurations for improved deployment flexibility

@AnkushMalaker

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes add conditional startup gating to Docker Compose services using profiles. The Caddy service is gated behind an https profile and the webui-dev service behind a dev profile. The services.py module is enhanced to automatically append the --profile https flag to docker compose commands when a Caddyfile exists in the backend service path.

Changes

Cohort / File(s) Summary
Docker Compose Profile Configuration
backends/advanced/docker-compose.yml
Added profiles: ["https"] to Caddy service and profiles: ["dev"] to webui-dev service to enable selective startup. Includes clarifying comment for Caddy startup condition.
Backend Service HTTPS Profile Logic
services.py
Added conditional logic to append --profile https flag to docker compose commands for backend services when a Caddyfile exists in the service path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Profiles gated with care,
Caddy's HTTPS shines in the air,
Dev mode hops in when needed,
Files checked, conditions heeded,
Compose commands, now more fair!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "add https profile to caddy service in docker compose" accurately describes the primary focus stated in the PR objectives, which emphasizes adding an HTTPS profile to the Caddy service. The title is clearly related to a significant part of the actual changeset, specifically the docker-compose.yml modifications for the Caddy service. However, the title does not mention all changes in the PR, which also include adding a dev profile to the webui-dev service and modifications to services.py to implement backend-specific HTTPS profile handling. Despite this incomplete coverage, the title provides meaningful and accurate information about a core aspect of the change without being misleading or off-topic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/caddyfile-error

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8fe109d and f6fac9a.

📒 Files selected for processing (2)
  • backends/advanced/docker-compose.yml (2 hunks)
  • services.py (1 hunks)
🔇 Additional comments (3)
backends/advanced/docker-compose.yml (2)

108-108: LGTM! Helpful documentation.

The comment clearly explains when the Caddy service starts, making the conditional activation transparent to users.


122-123: LGTM! Correct profile configuration.

The profile gating is properly configured and integrates correctly with the services.py automation. The Caddy service will now start automatically when the backend is started with a Caddyfile present, and remain dormant otherwise.

services.py (1)

74-79: <!-- [scratchpad_start]
[task code_analysis_final]
Complete verification accomplished

[observations]

  • Line 55: subprocess.run() executes the cmd list with cwd=service_path
  • For backend with Caddyfile and 'down' command:
    • cmd = ['docker', 'compose', '--profile', 'https', 'down']
    • Executed via subprocess.run with correct working directory
  • No build: line 55-61 path (non-build commands run silently)
  • Build: line 10-16 path (Popen with real-time output)

[analysis]

  • Docker Compose profile syntax is correct
  • The --profile https flag is placed before the action (down/up), which is correct
  • subprocess.run will execute: docker compose --profile https down
  • Docker Compose applies profile filters to both up and down operations
  • Profile-based services in down command are properly stopped by Compose

Conclusion:

  • Original review comment concerns verified and resolved
  • Code logic is correct and will work as intended
  • Down command with --profile https will properly stop Caddy
  • Optional improvement (user feedback) remains valid but not mandatory

[done]
Static analysis confirms code correctness. No functional issues found.
Verification complete - ready to generate final review comment.
</scratchpad_end]

✅ Logic verified and confirmed correct.

The HTTPS profile is correctly applied for both up and down commands. When the backend service stops, docker compose --profile https down will properly stop the Caddy container since profile-based filtering applies to all compose operations.

The defensive is_file() check prevents activation if someone creates a Caddyfile directory by mistake—good safeguard.

Consider adding user feedback when HTTPS mode is enabled to improve clarity (optional enhancement):

if service_name == 'backend':
    caddyfile_path = service_path / 'Caddyfile'
    if caddyfile_path.exists() and caddyfile_path.is_file():
        cmd.extend(['--profile', 'https'])
        if command == 'up':
            console.print("[dim]  🔒 HTTPS mode enabled (Caddyfile detected)[/dim]")

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Oct 24, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AnkushMalaker AnkushMalaker merged commit c117cb0 into main Oct 24, 2025
1 check passed
@AnkushMalaker AnkushMalaker deleted the fix/caddyfile-error branch October 24, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant